namespace :radiant do
  namespace :extensions do
    namespace :external_rss do
      
      desc "Runs the migration of the extension"
      task :migrate => :environment do
        require 'radiant/extension_migrator'
        if ENV["VERSION"]
          ExternalRssExtension.migrator.migrate(ENV["VERSION"].to_i)
        else
          ExternalRssExtension.migrator.migrate
        end
      end
    
      namespace :update do
        desc "Updates public assets of the extension"
        task :public => :environment do
          root = File.expand_path(ExternalRssExtension.root)
          sources = Dir.glob(File.join(root, 'public', '*'))
          destination = File.join(root, '../../../public')
          cp_r sources, destination
        end
      end
    end
  end
end